﻿

(function ($) {

    var defaults = {
        type: 'normal'
    };

    var method = {
        init: function (options) {
            defaults = $.extend(defaults, options);
        },

        setNewPos: function () {
            return this.each(function () {
                console.log(myfunction());
                console.log(defaults.name);
            });
        },
        resetPos: function () {
            $(this).css({ width: "100px", height: "100px" });
            $(this).css({ left: "0", top: "0" });
        }
    };

    $.fn.mousePosPlugin = function (method) {
        if (methods[method]) {
            return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
        } else if (typeof method === 'object' || !method) {
            return methods.init.apply(this, arguments);
        } else {
            $.error('Method ' + method + ' does not exist on jQuery.tooltip');
        }
    };

    function myfunction() {
        return defaults.type;
    }

})(jQuery);

$(document).mousePosPlugin({ name: 'myplugin' });



